<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
		"http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>    
<%@taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<html>
    <head>
			<link href="<c:url value="/resources/homepage.css" />" rel="stylesheet">    
         	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Storyboard</title>
</head>
<body>
<div id="wrapper">
<!-- ============ HEADER SECTION ============== -->
		<div id="header">
			<div id="headerlogo">
				
			</div>
		</div>
<!-- ============ NAVIGATION SECTION ============== -->
	<div id="menubar">
		
		<ul>
<li><a href="Project">Projects</a></li>
					<li><a href="Backlog">Backlog</a></li>
					<li><a href="SprintPlanning">Sprint Planning</a></li>
					<li><a href="Storyboard1" ><span class="currentLink">Sprint Tracking</span></a></li>
					<li><a href="logout">Logout</a></li>
                    <li><a href="#">${username}</a></li>	
				</ul>
	</div>
<!-- ============ MIDDLE SECTION ============== -->
		<div id="main">
		<!--	copy starts from here	-->
		<div id="projectitle">
		<h3>Storyboard</h3>
		</div>
		
				
<%-- 		 <sql:setDataSource --%>
<%-- 				var="myDS" --%>
<%-- 				driver="com.mysql.jdbc.Driver" --%>
<%-- 				url="jdbc:mysql://localhost:3306/springct" --%>
<%-- 				user="root"  --%>
<%-- 				password="root"	/> --%>
<%-- 				<sql:query var="story"	dataSource="${myDS}"> --%>
<%-- 					select sprint_name from sprint where sprint_id=<%=request.getParameter("sprint_id") %>; --%>
<%-- 				</sql:query> --%>

			
		<form:form action="StoryDetails1" method="post" modelAttribute="story">
		
	
		<sql:setDataSource 
  				var="myDS"  
  				driver="com.mysql.jdbc.Driver" 
 				url="jdbc:mysql://localhost:3306/springct" 
  				user="root" 
  				password="dhanashree"	/>  
  				<sql:query var="story1"	dataSource="${myDS}">
 					select sprint_id, sprint_name from sprint
  				</sql:query>
			 			
			 			
			 <c:forEach var="story1" items="${story1.rows }">	            
   			<a href="Storyboard1?sprintId=${story1.sprint_id}">${story1.sprint_name}</a> 
  <!--  	<a href="Storyboard1?sprintId=2">Sprint2</a> <a href="Storyboard1?sprintId=3">Sprint3</a></h4> -->
  			</c:forEach>
	
	
      <table >
          <tr>
				<th>STORY NAME</th>
				<th>OWNER</th>
				<th>STATUS</th>
				<th></th>
          </tr>
			<sql:setDataSource
				var="myDS"
				driver="com.mysql.jdbc.Driver"
				url="jdbc:mysql://localhost:3306/springct"
				user="root" 
				password="dhanashree"	/>
		  		<sql:query var="story"	dataSource="${myDS}">
					select sprint_name from sprint where sprint_id=<%=request.getParameter("sprintId") %>;
				</sql:query>
			
			<h4>
			<c:forEach var="sprint1" items="${story.rows}">
				
			Selected sprint :${sprint1.sprint_name } 
			</c:forEach>
			</h4>	              
			<sql:setDataSource
				var="myDS"
				driver="com.mysql.jdbc.Driver"
				url="jdbc:mysql://localhost:3306/springct"
				user="root" 
				password="dhanashree"	/>
		  		<sql:query var="story"	dataSource="${myDS}">
					select story.story_id,story.story_title,story_owner,status.status_name from story,status where story.status_id = status.status_id and sprint_id=<%=request.getParameter("sprintId") %>;
				</sql:query>
            <tr>
            <c:forEach var="story" items="${story.rows}">
				<tr>
					<td>
						<a href="Taskboard1?story_id=${story.story_id}"><!-- Add StoryDetails1 in href -->
							<c:out value="${story.story_title}" /></a></td>
					<td><c:out value="${story.story_owner}" /></td>
					<td><c:out value="${story.status_name}" /></td>
					<td><a href="StoryDetails1?story_id=${story.story_id}">Details</a></td>
				</tr>
			</c:forEach>
          </tr>
<!--
           <tr>
           	<c:forEach var="story" items="${storyNames}" >
		  		<tr>
					<td><a href="Taskboard1?story_id=${story.story_id}">${story.story_title}</a></td>
  					<c:forEach var="status" items="${listStatus }">
  						
  						<td>${status.status_name}</td>
  						  
  					</c:forEach>
		  		</tr>
 			</c:forEach> 
          </tr>
      -->     
      </table>
		<!--	copy ends from here	-->
	
		</form:form>
		</div>
		<div id="footer">
				<p>Copyright &copy; 2014 - All Rights Reserved - Spring Computing Pvt. Ltd.</p>

		</div>

</div>
</body>
</html>